package org.anyfiles.utils;

public class DigestUtil {

	public static char HEX_DIGITS[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};

	public static String byteToHex(byte[] bytes, int start, int end) {
		StringBuffer stringBuffer = new StringBuffer(end * 2);
		int length = start + end;
		for (int i = start; i < length; i++) {
			byte b = bytes[i];
			char hight = DigestUtil.HEX_DIGITS[(b & 0xf0) >> 4];
			char low = DigestUtil.HEX_DIGITS[b & 0xf];
			stringBuffer.append(hight);
			stringBuffer.append(low);
		}
		return stringBuffer.toString();
	}
}
